﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameSDK.Player;
using GuessNumberGame.Board;
using GameSDK.Events;

namespace GuessNumberGame.Player
{
    public class GuessNumberPlayer : StdPlayer
    {
        #region Attributes
        private int _lowerBound;
        public int LowerBound {
            get { return _lowerBound; }
            set { _lowerBound = value; }
        }

        private int _upperBound;
        public int UpperBound
        {
            get { return _upperBound; }
            set { _upperBound = value; }
        }

        #endregion

        #region Constructor

        public GuessNumberPlayer(GuessNumberBoard board)
            : base(board)
        {
            this.LowerBound = board.LowerBound;
            this.UpperBound = board.UpperBound;
            ((GuessNumberBoard) this.Board).PlayerMove += new GameSDK.Board.PlayerMovedEventHandler(DoPlayMove);
        }
        #endregion

        #region Override Methods
        public override void DoPlayMove(object sender, MoveEventArgs MoveArgs)
        {
            GuessNumberMove move = (GuessNumberMove)MoveArgs.Move();
            if (MoveArgs.Player().GamePlayerId != this.GamePlayerId)
            {
                this.NextMove();
            }

            
        }
        #endregion

        public override String ToString()
        {
            return this.GamePlayerId + " [" + this.LowerBound + ", " + this.UpperBound + "]";
        }

    }
}
